public class BinaryTree implements IList{
    public int Treesize;
//    获取树中结点的个数,那就是遍历一边即可
    @Override
    public int size(BTNode root) {
//        这里随便选一种
        if(root==null){
            return 0;
        }
        Treesize++;
        size(root.left);
        size(root.right);
        return 0;
    }

    @Override
    public int getLeafNodeCount(BTNode root) {
        return 0;
    }

    @Override
    public int getKLevelNodeCount(BTNode root) {
        return 0;
    }

    @Override
    public int getHeight(BTNode root) {
        return 0;
    }

    @Override
    public BTNode find(BTNode root, int val) {
        return null;
    }

    @Override
    public void levleOrder(BTNode root) {

    }

    @Override
    public boolean isCompleteTree(BTNode root) {
        return false;
    }

    //    先创建一个节点
    public static class BTNode{
    public BTNode left;
    public BTNode right;
    public int val;
//    给结点写一个构造方法
    public BTNode(int val){
        this.val=val;
    }
   }
   public BTNode root;
//    先创建一个树,为了方便操作
    public void createBinaryTree(){
        BTNode node1=new BTNode(1);
        BTNode node2=new BTNode(2);
        BTNode node3=new BTNode(3);
        BTNode node4=new BTNode(4);
        BTNode node5=new BTNode(5);
        BTNode node6=new BTNode(6);
        BTNode node7=new BTNode(7);
        BTNode node8=new BTNode(8);
        root=node1;
        node1.left=node2;
        node1.right=node3;
        node3.left=node4;
        node4.right=node5;
        node5.left=node6;
        node5.right=node7;
        node3.right=node8;
    }
//    接着写二叉树的三种遍历方式
//    1.前序遍历
    public void preOrder(BTNode root){
        if(root==null){
            return;
        }
        System.out.print(root.val+" ");
        preOrder(root.left);
        preOrder(root.right);
    }
//    中序遍历
    public void inOrder(BTNode root){
        if(root==null){
            return;
        }
        inOrder(root.left);
        System.out.print(root.val+" ");
        inOrder(root.right);

    }
//    后序遍历
    public void postOrder(BTNode root){
        if(root==null){
            return;
        }
        postOrder(root.left);
        postOrder(root.right);
        System.out.print(root.val+" ");
    }






}
